package reflect;

import reflect.annotation.AutoRunMethod;

import java.lang.reflect.Method;

public class ReflectDemo12 {
    public static void main(String[] args) throws Exception {
        Class<?> cls = Class.forName("reflect.Person");
        Method method = cls.getMethod("sayHello");
        if(method.isAnnotationPresent(AutoRunMethod.class)){
            //通过反射获取注解对象
           AutoRunMethod arm =  method.getAnnotation(AutoRunMethod.class);
           //获取注解的属性值
           int value = arm.value();
           System.out.println("注解的属性值是："+value);
        }
    }
}
